<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title><?= $title; ?></title>
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 9]>
    <script src="https://cdn.bootcss.com/html5shiv/3.7.3/html5shiv.min.js"></script>
    <script src="https://cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <script src="http://apps.bdimg.com/libs/jquery/1.11.3/jquery.min.js"></script>
    <!-- Bootstrap -->
    <link rel="stylesheet" href="https://cdn.bootcss.com/bootstrap/3.3.7/css/bootstrap.min.css">
    <script src="https://cdn.bootcss.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
    <style>
        .text_center {
            text-align: center;
        }
        /*请求参数*/
        .request_messge_name_width {
            width: 200px;
        }
        .request_param_name {
            width: 150px;
        }
        .request_param_type {
            width: 150px;
        }
        .request_param_pass {
            width: 80px;
        }
        /* 固定菜单接口 */
        .dw {
            position: fixed;
            top: 0px;
            z-index: 999;
            width: inherit;
        }
        .dw_menu {
            width: 100%;
            height: 42px;
            padding: 3px;
        }
        .dw_content {
            max-height: 500px;
            overflow: auto;
        }
        /*返回顶部*/
        .top {
            position: fixed;
            z-index: 999;
            bottom: 60px;
            cursor: pointer;
        }
        /* 巨幕框 */
        .jumbotron {
            margin-top: 10px;
            margin-bottom: 0px;
            font-weight: 1000;
            font-size: 40px;
        }
    </style>
</head>
<body>

<div class="container-fluid">
    <div class="row">
        <!-- 主体 -->
        <div class="col-lg-7 col-lg-offset-1 col-md-7 col-md-offset-1">
            <!-- 巨幕消息框 -->
            <div class="row jumbotron text-center">
                <?= $title; ?>
            </div>

            <?php foreach ($data as $key => $value) { ?>
                <div class="row" id="<?php echo $key + 1; ?>">
                    <h2><b><?php echo $key + 1; ?>&nbsp;<?php echo $value['name']; ?></b></h2>

                    <!-- 请求信息 -->
                    <p>请求信息</p>
                    <table class="table table-bordered">
                        <tbody>
                        <tr>
                            <td class="request_messge_name_width">请求信息</td>
                            <td><?php echo $value['url']; ?></td>
                        </tr>
                        <tr>
                            <td class="request_messge_name_width">请求方法</td>
                            <td><?php echo $value['method']; ?></td>
                        </tr>
                        <?php if ($value['author']) { ?>
                            <tr>
                                <td class="request_messge_name_width">作者</td>
                                <td><?php echo $value['author']; ?></td>
                            </tr>
                        <?php } ?>
                        </tbody>
                    </table>

                    <!-- 请求参数 -->
                    <?php if ($value['param']) { ?>
                        <p>请求参数</p>
                        <table class="table table-bordered">
                            <thead>
                            <td class="request_param_name">参数名</td>
                            <td class="request_param_type">类型</td>
                            <td class="request_param_pass">是否必传</td>
                            <td>描述</td>
                            </thead>
                            <tbody>
                            <?php foreach ($value['param'] as $param) { ?>
                                <tr>
                                    <td><?php echo $param['param']; ?></td>
                                    <td><?php echo $param['type']; ?></td>
                                    <td>
                                        <?php if ($param['pass'] == 'R') { ?>
                                            是
                                        <?php } elseif ($param['pass'] == 'O') { ?>
                                            否
                                        <?php } ?>
                                    </td>
                                    <td><?php echo $param['bewrite']; ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    <?php } ?>

                    <!-- 返回信息 -->
                    <?php if ($value['response']) { ?>
                        <p>返回信息</p>
                        <table class="table table-bordered">
                            <thead>
                            <td class="request_param_name">参数名</td>
                            <td class="request_param_type">类型</td>
                            <td>描述</td>
                            </thead>
                            <tbody>
                            <?php foreach ($value['response'] as $response) { ?>
                                <tr>
                                    <td><?php echo $response['param']; ?></td>
                                    <td><?php echo $response['type']; ?></td>
                                    <td><?php echo $response['bewrite']; ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    <?php } ?>

                    <!-- 返回参数 -->
                    <?php if ($value['field']) { ?>
                        <p>返回参数</p>
                        <table class="table table-bordered">
                            <thead>
                            <td class="request_param_name">参数名</td>
                            <td class="request_param_type">类型</td>
                            <td>描述</td>
                            </thead>
                            <tbody>
                            <?php foreach ($value['field'] as $field) { ?>
                                <tr>
                                    <td><?php echo $field['param']; ?></td>
                                    <td><?php echo $field['type']; ?></td>
                                    <td><?php echo $field['bewrite']; ?></td>
                                </tr>
                            <?php } ?>
                            </tbody>
                        </table>
                    <?php } ?>

                    <!-- json -->
                    <?php if ($value['returnjson']) { ?>
                        <p>返回JSON样例</p>
                        <?php foreach ($value['returnjson'] as $returnjson) { ?>
                            <pre><?php echo $returnjson; ?></pre>
                        <?php } ?>
                    <?php } ?>

                    <!-- string -->
                    <?php if ($value['returnstring']) { ?>
                        <p>返回String样例</p>
                        <?php foreach ($value['returnstring'] as $returnstring) { ?>
                            <pre><?php echo $returnstring; ?></pre>
                        <?php } ?>
                    <?php } ?>

                </div>
            <?php } ?>
            <!-- 主体结束 -->
        </div>


        <!-- 菜单 -->
        <div class="col-lg-3 col-md-3">

            <div class="list-group dw">
                <!-- 按钮组 -->
                <div class="dw_menu btn-primary">
                    <?php foreach ($array['version'] as $value) { ?>
                        <a href="?version=<?php echo $value; ?>" class="btn <?php if ($value == $version) {
                            echo 'btn-warning';
                        } ?> btn-default active" role="button"><?php echo $value; ?></a> &nbsp;&nbsp;
                    <?php } ?>
                </div>

                <ul class="list-group dw_content">
                    <?php foreach ($array['title'] as $value) { ?>
                        <li class="list-group-item list-group-item-success text_center">
                            <?php echo $value; ?>
                        </li>
                        <div>
                            <?php foreach ($data as $key => $v) { ?>
                                <?php if ($value == $v['title']) { ?>
                                    <a href="#<?php echo $key + 1; ?>"
                                       class="list-group-item"><?php echo $key + 1; ?>&nbsp;<?php echo $v['name']; ?></a>
                                <?php } ?>
                            <?php } ?>
                        </div>
                    <?php } ?>
                </ul>

            </div>
        </div>

        <!-- 返回顶部 -->
        <div class="col-lg-1 col-md-1">
            <a href="javascript:scrollTo(0,0);"><img width="29" height="65"
                                                     src="//r1.ykimg.com/05100000575CCAF767BC3D4B250267B7" class="top"></a>
        </div>

    </div>

    <br><br><br><br><br><br><br><br><br><br><br><br><br><br><br>
</div>

</body>
</html>